<?php

/**
 * Description of DA_Momentos
 *
 * @author janunezc
 */
class DA_Momentos {

    public static function ObtenerMomentosDeCancion($cancion_id) {
        $SQLCommand = "
SELECT mo.momento_id, mo.momento_nm, cm.cancion_id, mo.orden
FROM momentos mo
LEFT OUTER JOIN canciones_momentos cm on mo.momento_id = cm.momento_id
AND (cancion_id = $cancion_id OR cancion_ID is null)
ORDER BY mo.orden            
";

        $queryResult = DataAccessHelper::executeSQL($SQLCommand);
        
        $listaDeMomentos = Array();

        if ($queryResult) {
            while ($row = mysql_fetch_row($queryResult)) {
                $momento = new BEMomento();
                $momento->momento_id = $row[0];
                $momento->momento_nm = $row[1];
                $momento->checked = "";
                if($row[2]!=NULL){
                    $momento->checked = "checked='checked'";
                }
                
                $listaDeMomentos[] = $momento;
            }
        }
        return $listaDeMomentos;
    }

}

?>
